home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
tex
/
cc21d.zip
/
CC.DOC
< prev
next >
Wrap
Text File
|
1994-03-08
|
9KB
|
222 lines
CC, v2.1
-------------
from TifaWARE
What's New
----------
Although CC is a pretty simple program, earlier versions do appear to
suffer from one problem. When used to redirect output to a HP LaserJet
printer CC sometimes appears to lose formfeed characters. Actually, this
is not a problem with CC but occurs because the printer ignores formfeeds
found anywhere other than at the start of a line. To avoid this aberrant
behaviour then, formfeeds are now preceded by a single carriage return
starting with version 2.1.
Many of the principal functions in CC have been completely rewritten
for version 2.0. Additionally, AT&T's getopt() function is now used for a
consistent method of processing commandline options. Since it did not get
much use, the tab-expansion option will no longer be included in CC.
Version 1.2 of CC does not represent much of an improvement over the
preceding version, at least from the user's viewpoint. Some of the code
for displaying the on-line help message was improved, and error messages
are formated in a slightly different fashion.
Introduction
------------
In my work on an IBM mainframe, I frequently come across files with
carriage controls in the first column of each line. Printing such files on
the mainframe's printer is no problem, but more often than not I'd rather
download them to my PC and print them at my convenience. The problem,
though, has been that PC printers don't understand carriage controls, just
characters like <form feed>, <carriage return>, <linefeed>, etc, ...
The algorithm to replace those carriage controls with characters PCs
understand is simple enough. Yet calling up an editor and making the
changes for each file is a hassle I'd rather avoid. Hence I've devised
this little text filter. It's called, appropriately enough, CC. And its
sole purpose is to process files with carriage controls.
Characters are read one at a time from the input file(s). Most are
simply output with no changes; however, the first character in each line is
interpreted as an ASA carriage control in the following fashion:
Carriage Control Interpretation
---------------- --------------
space Advance 1 line before printing
0 Advance 2 lines before printing
- Advance 3 lines before printing
+ Surpress line advance before printing
1 Advance to new page
With one exception, invalid carriage controls cause CC to print a <carriage
return>, the rest of the line, and then a <linefeed>. [The sole exception
concerns empty lines, which are treated the same as lines composed of just
one space.] Should you ever see a bunch of lines missing letters at the
start, you probably filtered a file through CC which didn't contain
carriage controls.
Usage
-----
Running this program is quite simple. Assuming you've placed CC.COM
on your system where DOS can find it, type CC -? to display a brief help
message similar to the following:
TifaWARE CC, v2.1d, processes ASA carriage control characters.
Copyright (c) 1991-1993 by TifaWARE/George A. Theall.
usage: cc [options] [file(s)]
Options:
-? = provide this help message
Stdin is used if no files are specified. Wildcards are not allowed.
[If you don't remember anything else from reading the documentation, at
least remember how to display this help message.] Files names must be
unique; that is, wildcards are _not_ supported.
CC sequentially processes each file named on the command line, or
standard input if none are specified. Trouble opening a file (because
say, the name was misspelled) simply causes CC to skip to the next file.
A read or write error during processing will, however, cause the program
to abort.
CC's output is written to a device called stdout, which is normally
your computer's screen. Using the DOS redirection characters '>' and '|',
you could send this output to a disk file, printer, or even use it as input
into another program. [Refer to your DOS manual for more information on
output redirection.] The flexibility of this approach should be clear.
If You Have Any Trouble
-----------------------
CC will attempt to let you know of any problems that arise. Here are
the messages you might see and how you should deal with them:
cc: illegal option -- x.
- Type "CC -?" for a list of valid options. If your
file's name starts with a '-', you can avoid having
CC treat the name as a set of options by prefixing
the name with a path; e.g., CC .\-ODDNAME.LOG.
cc: can't open BADFILE.
- CC was unable to open for input the file BADFILE.
Check the spelling and make sure the file actually
exists.
cc: can't read from SOMEFILE; processing halted at line 117.
- CC ran into trouble while attempting to read from
SOMEFILE. The line number reported by CC refers to
the last line processed from the *input* file. This
error indicates a serious problem exists with your
file. You should examine the file using a program
such as Norton Utilities or make another copy of
the file for CC to use.
cc: can't write to stdout; processing halted at line 92 of SOMEFILE.
- The reason for this error depends on the particular type
of output redirection (if any) you're using. Perhaps the
disk to which you're sending output has become full;
perhaps the printer has become jammed or lost power, ...
however, you should never see this one if you're just
sending output to the screen. Once again, the line number
reported by CC refers to the input file.
These error messages are written to the standard error device. In this
way, they won't disappear down a pipe or into a file should you try to
redirect CC's output.
Additionally, CC uses a return code to convey information about the
success or failure of its operation. Possible return values are:
Code Meaning
---- -------
0 All files were processed successfully
1 Help message was displayed
10 At least 1 file was not opened for processing
15 Trouble was encountered reading from a file
20 Trouble was encountered writing to stdout
You can test for these codes using the ERRORLEVEL variable in a batch file.
Requirements
------------
TifaWARE CC runs on machines operating under MS-DOS v2.xx or later,
and requires about 10K of memory. It does not use BIOS calls, make direct
writes to video RAM, or otherwise require machines to be "PC-compatible".
In fact, CC even runs properly on a DEC Rainbow!
Who Owns It?
---------------
The source code for CC is public domain. I do, however, retain the
copyright on the compiled program in order to abide by the license
agreement for Borland C++; you may freely redistribute and use it.
CC carries no obligation on my part to support users or provide
future upgrades. I have tried to write clean code and believe it to be
"bug-free". Nevertheless, you must use this program ***AT YOUR OWN
RISK***.
As author of CC, I ask of you two things: First, if you redistribute
this program please keep together my original source code, documentation,
and executable. This just makes it easier for others to use the software.
Second, let me hear what you think of CC - I'd appreciate a postcard with
your comments. Enjoy!
Kudos
-----
Borland deserves a great deal of credit for its compiler and stand-
alone debugger. Together these products make C programming a joy.
George A. Theall